home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / diskread.zip / INT13.ASM < prev    next >
Assembly Source File  |  1986-10-22  |  11KB  |  186 lines

  1.           TITLE         INT13
  2.           PAGE          ,132
  3.  
  4. ;********************************************************************
  5. ;*                                                                  *
  6. ;* INT13       Version 1.0       10/21/86                           *
  7. ;*                                                                  *
  8. ;* Copyright 1986 Michael L. Brown                                  *
  9. ;*                Nicolet Instrument Corp                           *
  10. ;*                5225 Verona Rd                                    *
  11. ;*                Madison, WI  53711                                *
  12. ;*                (608) 273-5039                                    *
  13. ;*                                                                  *
  14. ;* The user is hereby granted permission to use this program.       *
  15. ;* User may not sell program.  User may change and distribute this  *
  16. ;* program, but may not charge for it.  This program may be used    *
  17. ;* in other programs, but may not charge extra for its inclusion.   *
  18. ;*                                                                  *
  19. ;* See the BASIC program DISKREAD.BAS for where to send corrections,*
  20. ;* enhancements, etc.                                               *
  21. ;*                                                                  *
  22. ;********************************************************************
  23.           PAGE
  24. ;********************************************************************
  25. ;*                                                                  *
  26. ;* An assembly language interface to the BASIC program DISKREAD,    *
  27. ;* which allows the BASIC program to read absolute hard disk        *
  28. ;* sectors.                                                         *
  29. ;*                                                                  *
  30. ;* BASIC syntax is:                                                 *
  31. ;*                                                                  *
  32. ;*      CALL INT13(ES%,BX%,AL%,AH%,CL%,CH%,DL%,DH%)                 *
  33. ;*                                                                  *
  34. ;* The registers work as follows:                                   *
  35. ;*                                                                  *
  36. ;*      AL%   Number of sectors to read/write                       *
  37. ;*      AH%   The DISKBIOS INT 13h operation:                       *
  38. ;*                00 Reset disk/diskette                            *
  39. ;*                01 Read status of last disk operation into AL%    *
  40. ;*                02 Read sectors into memory                       *
  41. ;*                03 Write sectors into memory                      *
  42. ;*                04 Verify the sectors                             *
  43. ;*                05 Format the track                               *
  44. ;*                06 Format the track & set bad sector flags        *
  45. ;*                07 Format the drive starting at track             *
  46. ;*                08 Return the current drive parameters            *
  47. ;*                09 Initialize drive pair characteristics          *
  48. ;*                     INT 41 points to data block                  *
  49. ;*                0A Read long                                      *
  50. ;*                0B Write long                                     *
  51. ;*                0C Seek                                           *
  52. ;*                0D Alternate disk reset (see DL)                  *
  53. ;*                0E Read sector buffer                             *
  54. ;*                0F Write sector buffer                            *
  55. ;*                10 Test drive ready                               *
  56. ;*                11 Recalibrate                                    *
  57. ;*                12 Controller RAM diagnostics                     *
  58. ;*                13 Drive diagnostics                              *
  59. ;*                14 Controller internal diagnostics                *
  60. ;*      CL%   Sector number (1-17, not checked)                     *
  61. ;*      CH%   Cylinder number (0-1023, not checked)                 *
  62. ;*      DL%   Drive number (80h-87h for disk, checked)              *
  63. ;*      DH%   Head number (0-7, not checked)                        *
  64. ;*                                                                  *
  65. ;* The cylinder (track) number is 10 bits, so the upper 2 bits      *
  66. ;* of the cylinder number are placed in the top 2 bits of CL%.      *
  67. ;* The remaining 8 bits are placed into CH%.  Even tho CL% and CH%  *
  68. ;* are 16 bit BASIC integers, to the 8088, CL and CH are 8 bits.    *
  69. ;*                                                                  *
  70. ;********************************************************************
  71.           PAGE
  72. ;********************************************************************
  73. ;*                                                                  *
  74. ;* When the INT13 program returns to BASIC, the following values    *
  75. ;* are passed back:                                                 *
  76. ;*                                                                  *
  77. ;*      AH%   The DISKBIOS INT 13h error numbers:                   *
  78. ;*                00 Operation OK                                   *
  79. ;*                01 Bad command                                    *
  80. ;*                02 Bad address mark                               *
  81. ;*                04 Record not found                               *
  82. ;*                05 Bad reset                                      *
  83. ;*                07 Init failure                                   *
  84. ;*                09 DMA boundary                                   *
  85. ;*                0B Bad cylinder (track)                           *
  86. ;*                10 Bad ECC                                        *
  87. ;*                11 Data corrected  AL% contains burst length      *
  88. ;*                20 Bad controller                                 *
  89. ;*                40 Bad seek                                       *
  90. ;*                BB Undefined error                                *
  91. ;*                FF Sense failure                                  *
  92. ;*      ES%   Segment location of data                              *
  93. ;*      BX%   Offset location of data                               *
  94. ;*                                                                  *
  95. ;* If disk parameters wanted:                                       *
  96. ;*                                                                  *
  97. ;*      CL%   Maximum useable sector & top 2 cylinder bits          *
  98. ;*      CH%   Bottom 8 bits of cylinder number                      *
  99. ;*      DL%   Number of known drives attached                       *
  100. ;*      DH%   Maximum useable head number                           *
  101. ;*                                                                  *
  102. ;* Assemble this code using the MASM assembler:                     *
  103. ;*                                                                  *
  104. ;*      MASM INT13,,INT13;                                          *
  105. ;*                                                                  *
  106. ;********************************************************************
  107.           PAGE
  108. PARMLST   STRUC
  109. SAVE_BP   DW            ?               ;Save contents of BP
  110. RET_OFF   DW            ?               ;Return address of calling program
  111. RET_SEG   DW            ?
  112. REGDH     DW            ?               ;Offset from DS of 8th argument
  113. REGDL     DW            ?               ;Offset from DS of 7th argument
  114. REGCH     DW            ?               ;Offset from DS of 6th argument
  115. REGCL     DW            ?               ;Offset from DS of 5th argument
  116. REGAH     DW            ?               ;Offset from DS of 4th argument
  117. REGAL     DW            ?               ;Offset from DS of 3rd argument
  118. REGBX     DW            ?               ;Offset from DS of 2nd argument
  119. REGES     DW            ?               ;Offset from DS of 1st argument
  120. PARMLST   ENDS
  121.  
  122. PARM_SIZE EQU           REGES - REGDH + TYPE REGES
  123.  
  124. CODE SEGMENT BYTE PUBLIC 'CODE'
  125.           ASSUME CS:CODE,DS:CODE
  126.  
  127. BUF